package demo.hw;

import java.util.Scanner;

/**
 * 第一行输入字符串 第二行输入一个字母
 *
 * 输入
 * ABCabc
 * A
 * 输出
 * 2
 *
 * @author taqo
 * @date 2021/5/24
 */
public class _计算某字母出现次数 {
    public static void main(String[] args) {
        Scanner sc1 = new Scanner(System.in);
        String s1 = sc1.nextLine().toLowerCase();
        Scanner sc2 = new Scanner(System.in);

        String s2 = sc1.nextLine().toLowerCase();
        sc1.close();
        sc2.close();
        System.out.println(countC(s1,s2.charAt(0)));
    }

    private static int countC(String s1, char s2) {
        int c = 0;
        for (int i = 0; i < s1.length(); i++) {
            char cc = s1.charAt(i);
            if (cc == s2) {
                c+=1;
            }
        }
        return c;
    }
}
